<!DOCTYPE html>
<html lang="en">
<head th:include="certificateWeb/headFoot :: headerCss">
</head>
<link rel="stylesheet" href="/css/certificateWeb/workNews/workNews.css">
<style>
    .b18 {
    width: 300px;
    margin:0 auto 20px auto;
}
    .download{
        border: 1px solid #005C34;
        color: #005C34;
        padding: 4px;
        margin-right: 20px;
    }
</style>
<body id="body">
<div th:include="certificateWeb/headFoot :: header"></div>
<main id="main">
    <section class="sec_1">
        <div class="div_1">
            <ul>
                <li><a href="/certificate/testingCentreQuery">考核站点查询</a></li>
                <li><a href="/certificate/testingCentreQueryPx">培训基地查询</a></li>
                <li class="this"><a href="/certificate/certificateQuery">证书查询</a></li>
                <li><a href="/certificate/expertQuery">专家查询</a></li>
            </ul>
        </div>

        <div class="div_2">
            <label class="label_title">证书查询</label>
            <hr/>
            <div class="flex_a">
                <input type="text" name="numbers" 　id="certificateNo" placeholder="证书编号 " class="form-control" />
                <input class="form-control but_2" type="button" id="search" value="查询" />
            </div>
            <div class="div_2 div_01" id="list" style="margin-top: 20px">
            </div>
        </div>
        <div style="clear: both"></div>
    </section>

</main>
<div th:include="certificateWeb/headFoot :: footer"></div>
<script>
    $(function () {
        $("#search").click(function () {

            //查询简历·
            ajaxToken("/jzApi/user/selResume", "GET", {}, function (res) {
                console.log("5555 = " , res);
                if (res.state == 0){
                    var certificateNo = $("#certificateNo").val();
                    $.ajax({
                        url: '/jzApi/certificates/selCertificate',
                        data: {certificateNo: certificateNo},
                        success: function (res) {
                            if (res.code == 0) {
                                var gradeName = '';
                                if (res.data.grade == 0) {
                                    gradeName = '高级'
                                }else if(res.data.grade == 1){
                                    gradeName = '中级'
                                }else{
                                    gradeName = '初级'
                                }
                                var isEffective = '';
                                if(res.data.isEffective == 0){
                                    isEffective = '有效'
                                }else if(res.data.isEffective == 1){
                                    isEffective = '无效'
                                }else {
                                    isEffective = '证书已废除'
                                }
                                var content = '<image style="width:900px;height:636px;display: block;margin: 20px auto;text-align: center" src="' + res.data.cerImg + '"></image>' +
                                    '<div class="span_1" style="text-align: right"><a download target="_blank" href="' + res.data.cerImg + '" class="download">下载图片</a></div>' +
                                    '<div class="span_1 b18"><span class="title_1">证书名称：</span><p class="title_2">' + res.data.certificateName + '</p></div>' +
                                    '<div class="span_1 b18"><span class="title_1">证书等级：</span><p class="title_2">' + gradeName + '</p></div>' +
                                    '<div class="span_1 b18"><span class="title_1">证书编号：</span><p class="title_2">' + res.data.certificateNo + '</p></div>' +
                                    '<div class="span_1 b18"><span class="title_1">获证人姓名：</span><p class="title_2">' + res.data.name + '</p></div>' +
                                    '<div class="span_1 b18"><span class="title_1">获证时间：</span><p class="title_2">' + res.data.addTime + '</p></div>' +
                                    '<div class="span_1 b18"><span class="title_1">是否有效：</span><p class="title_2">' + isEffective + '</p></div>';
                                $("#list").html(content);

                            }

                        }
                    })
                }else {

                    layer.confirm("请先完善简历", {
                        btn: ['前去完善', '暂不完善']
                    }, function (index, layero) {
                        location.href = '/cultivate/myResume'
                    }, function (index) {

                    })

                }
            });
        })


    })
</script>
</body>
</html>